const state = {
    id: null,
    roleId: null,
    regionId: null,
    userName: null,
    isTokenExpired: false,
    userFullName: null
}

// getters
const getters = {
    isUserLoggedIn(state) {
        return state.id;
    },
}

// actions
const actions = {

}

// mutations
const mutations = {
    tokenExpiring(state) {
        state.isTokenExpired = true;
    },
    login(state, user) {
        state.id = user.id;
        state.userName = user.username;
        window.localStorage.setItem('user', JSON.stringify(user))
    },
}

export default {
    namespaced: true,
    state,
    getters,
    actions,
    mutations
}